<?php

    /**
     * Auth
     */
    Router::connect('/login', array('controller' => 'auth', 'action' => 'login'));
    Router::connect('/logout', array('controller' => 'auth', 'action' => 'logout'));
    Router::connect('/profile', array('controller' => 'auth', 'action' => 'profile'));

    /**
     * ClientAdmins
     */
    Router::connect('/client-admins', array('controller' => 'client_admins', 'action' => 'list_of'));
    Router::connect('/client-admins/new', array('controller' => 'client_admins', 'action' => 'create'));
    Router::connect('/client-admins/:id', array('controller' => 'client_admins', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/client-admins/:id/delete', array('controller' => 'client_admins', 'action' => 'remove'), array('id'=>'[0-9]+'));
    Router::connect('/clients/:client_id/admins', array('controller' => 'client_admins', 'action' => 'list_of'), array('client_id'=>'[0-9]+'));

    /**
     * Clients
     */
    Router::connect('/clients', array('controller' => 'clients', 'action' => 'list_of'));
    Router::connect('/clients/new', array('controller' => 'clients', 'action' => 'create'));
    Router::connect('/clients/:id', array('controller' => 'clients', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/clients/:id/delete', array('controller' => 'clients', 'action' => 'remove'), array('id'=>'[0-9]+'));
    Router::connect('/clients/:id/refill', array('controller' => 'clients', 'action' => 'refill_account'), array('id'=>'[0-9]+'));

    /**
     * Candidates
     */
    Router::connect('/clients/:client_id/candidates', array('controller' => 'candidates', 'action' => 'list_of'), array('client_id'=>'[0-9]+'));
    Router::connect('/clients/:client_id/candidates/:mode', array('controller' => 'candidates', 'action' => 'list_of'), array('mode' => 'export', 'client_id'=>'[0-9]+'));
    Router::connect('/clients/:client_id/candidates/new', array('controller' => 'candidates', 'action' => 'create'), array('client_id'=>'[0-9]+'));
    Router::connect('/clients/:client_id/candidates/:id', array('controller' => 'candidates', 'action' => 'details'), array('id'=>'[0-9]+', 'client_id'=>'[0-9]+'));
    Router::connect('/candidates', array('controller' => 'candidates', 'action' => 'list_of'));
    Router::connect('/candidates/:mode', array('controller' => 'candidates', 'action' => 'list_of'), array('mode' => 'export'));
    Router::connect('/candidates/new', array('controller' => 'candidates', 'action' => 'create'));
    Router::connect('/candidates/:id', array('controller' => 'candidates', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/:id/delete', array('controller' => 'candidates', 'action' => 'remove'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/:id/tools', array('controller' => 'candidates', 'action' => 'tools'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/:id/tools/apply/:tool_id', array('controller' => 'candidates', 'action' => 'apply_tool'), array('id'=>'[0-9]+', 'tool_id'=>'[0-9]+'));
    Router::connect('/candidates/:id/tools/appointed/:testing_id', array('controller' => 'candidates', 'action' => 'appointed_tool'), array('id'=>'[0-9]+', 'testing_id'=>'[0-9]+'));
    Router::connect('/candidates/:id/tools/fill_in/:testing_id/*', array('controller' => 'candidates', 'action' => 'fill_in_tool'), array('id'=>'[0-9]+', 'testing_id'=>'[0-9]+'));
    Router::connect('/candidates/:id/tools/get_blank/:testing_id/*', array('controller' => 'candidates', 'action' => 'get_tool_blank'), array('id'=>'[0-9]+', 'testing_id'=>'[0-9]+'));
    Router::connect('/candidates/:id/tools/send/:testing_id/*', array('controller' => 'candidates', 'action' => 'send_test_info'), array('id'=>'[0-9]+', 'testing_id'=>'[0-9]+'));
    Router::connect('/candidates/:id/tools/cancel/:testing_id', array('controller' => 'candidates', 'action' => 'cancel_tool'), array('id'=>'[0-9]+', 'testing_id'=>'[0-9]+'));
    Router::connect('/candidates/:id/report', array('controller' => 'candidates', 'action' => 'report'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/:id/reports', array('controller' => 'candidates', 'action' => 'reportings'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/:id/toarchive', array('controller' => 'candidates', 'action' => 'toarchive'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/:id/fromarchive', array('controller' => 'candidates', 'action' => 'fromarchive'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/:id/report/:reporting_id', array('controller' => 'candidates', 'action' => 'reporting'), array('id'=>'[0-9]+', 'reporting_id'=>'[0-9]+'));
    Router::connect('/admining/', array('controller' => 'candidates', 'action' => 'admining'));
    Router::connect('/reports/', array('controller' => 'candidates', 'action' => 'reports'));

    /**
     * Admins
     */
    Router::connect('/admins', array('controller' => 'admins', 'action' => 'list_of'));
    Router::connect('/admins/new', array('controller' => 'admins', 'action' => 'create'));
    Router::connect('/admins/:id', array('controller' => 'admins', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/admins/:id/delete', array('controller' => 'admins', 'action' => 'remove'), array('id'=>'[0-9]+'));

    /**
     * Lists
     */
    Router::connect('/lists', array('controller' => 'lists', 'action' => 'index'));

    /**
     * Regions
     */
    Router::connect('/lists/regions', array('controller' => 'regions', 'action' => 'list_of'));
    Router::connect('/lists/regions/new', array('controller' => 'regions', 'action' => 'create'));
    Router::connect('/lists/regions/:id', array('controller' => 'regions', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/lists/regions/:id/delete', array('controller' => 'regions', 'action' => 'remove'), array('id'=>'[0-9]+'));

    /**
     * Positions
     */
    Router::connect('/lists/positions', array('controller' => 'positions', 'action' => 'list_of'));
    Router::connect('/lists/positions/new', array('controller' => 'positions', 'action' => 'create'));
    Router::connect('/lists/positions/:id', array('controller' => 'positions', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/lists/positions/:id/delete', array('controller' => 'positions', 'action' => 'remove'), array('id'=>'[0-9]+'));

    /**
     * Ages
     */
    Router::connect('/lists/ages', array('controller' => 'ages', 'action' => 'list_of'));
    Router::connect('/lists/ages/new', array('controller' => 'ages', 'action' => 'create'));
    Router::connect('/lists/ages/:id', array('controller' => 'ages', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/lists/ages/:id/delete', array('controller' => 'ages', 'action' => 'remove'), array('id'=>'[0-9]+'));

    /**
     * Educations
     */
    Router::connect('/lists/educations', array('controller' => 'educations', 'action' => 'list_of'));
    Router::connect('/lists/educations/new', array('controller' => 'educations', 'action' => 'create'));
    Router::connect('/lists/educations/:id', array('controller' => 'educations', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/lists/educations/:id/delete', array('controller' => 'educations', 'action' => 'remove'), array('id'=>'[0-9]+'));

    /**
     * Seniorities
     */
    Router::connect('/lists/seniorities', array('controller' => 'seniorities', 'action' => 'list_of'));
    Router::connect('/lists/seniorities/new', array('controller' => 'seniorities', 'action' => 'create'));
    Router::connect('/lists/seniorities/:id', array('controller' => 'seniorities', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/lists/seniorities/:id/delete', array('controller' => 'seniorities', 'action' => 'remove'), array('id'=>'[0-9]+'));

    /**
     * CandidateGroups
     */
    Router::connect('/candidates/groups', array('controller' => 'candidate_groups', 'action' => 'list_of'));
    Router::connect('/candidates/groups/new', array('controller' => 'candidate_groups', 'action' => 'create'));
    Router::connect('/candidates/groups/:id', array('controller' => 'candidate_groups', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/groups/:id/manage', array('controller' => 'candidate_groups', 'action' => 'manage'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/groups/:id/delete', array('controller' => 'candidate_groups', 'action' => 'remove'), array('id'=>'[0-9]+'));
    Router::connect('/candidates/groups/:id/tools/apply/:tool_id', array('controller' => 'candidate_groups', 'action' => 'apply_tool'), array('id'=>'[0-9]+', 'tool_id'=>'[0-9]+'));
    Router::connect('/candidates/groups/:id/tools/cancel/:tool_id', array('controller' => 'candidate_groups', 'action' => 'cancel_tool'), array('id'=>'[0-9]+', 'tool_id'=>'[0-9]+'));

    /**
     * Articles
     */
    Router::connect('/articles', array('controller' => 'articles', 'action' => 'list_of'));
    Router::connect('/articles/new', array('controller' => 'articles', 'action' => 'create'));
    Router::connect('/articles/:id', array('controller' => 'articles', 'action' => 'details'), array('id'=>'[0-9]+'));
    Router::connect('/articles/:id/delete', array('controller' => 'articles', 'action' => 'remove'), array('id'=>'[0-9]+'));
    Router::connect('/help', array('controller' => 'articles', 'action' => 'index', array('tag'=>'HELP')));
    Router::connect('/help/:article', array('controller' => 'articles', 'action' => 'view', array('tag'=>'HELP', 'article'=>'[0-9a-zA-Z_:.-]+')));

    /**
     * Tests
     */
    Router::connect('/clients/:client_id/tools', array('controller' => 'tests', 'action' => 'tools_and_reports_list'), array('client_id'=>'[0-9]+'));
    Router::connect('/tests/new', array('controller' => 'tests', 'action' => 'create'), array('id'=>'[0-9]+'));
    Router::connect('/tests/:id/delete', array('controller' => 'tests', 'action' => 'remove'), array('id'=>'[0-9]+'));
    Router::connect('/tools/', array('controller' => 'tests', 'action' => 'tools_and_reports_list'));

    /**
     * Passes
     */
    Router::connect('/clients/:client_id/billing', array('controller' => 'passes', 'action' => 'list_of'), array('client_id'=>'[0-9]+'));
    Router::connect('/log/', array('controller' => 'passes', 'action' => 'list_of'));
    Router::connect('/log/export', array('controller' => 'passes', 'action' => 'list_of_export'));
    Router::connect('/log/statistics/', array('controller' => 'passes', 'action' => 'statistics'));
    Router::connect('/log/statistics/export', array('controller' => 'passes', 'action' => 'statistics_export'));
    Router::connect('/billing/', array('controller' => 'passes', 'action' => 'list_of'));
    Router::connect('/billing/export', array('controller' => 'passes', 'action' => 'list_of_export'));
    Router::connect('/billing/statistics/', array('controller' => 'passes', 'action' => 'statistics'));
    Router::connect('/billing/statistics/export', array('controller' => 'passes', 'action' => 'statistics_export'));

    /**
     * Testings
     */
    Router::connect('/testing/end', array('controller' => 'testings', 'action' => 'questionnaireEnd'));
    Router::connect('/testing/start', array('controller' => 'testings', 'action' => 'questionnaireStart'));
    Router::connect('/client/:client_id/test/:test_id/completed_testings_ajax', array('controller' => 'testings', 'action' => 'completed_testings', 'ajax'=>'Y'), array('client_id'=>'[0-9]+', 'test_id'=>'[0-9]+'));
    Router::connect('/test/:test_id/completed_testings_ajax', array('controller' => 'testings', 'action' => 'completed_testings', 'ajax'=>'Y'), array('test_id'=>'[0-9]+'));
    Router::connect('/client/:client_id/test/:test_id/completed_testings', array('controller' => 'testings', 'action' => 'completed_testings'), array('client_id'=>'[0-9]+', 'test_id'=>'[0-9]+'));
    Router::connect('/test/:test_id/completed_testings', array('controller' => 'testings', 'action' => 'completed_testings'), array('test_id'=>'[0-9]+'));
    Router::connect('/candidates/:candidate_id/tools/enter_result/:testing_id/*', array('controller' => 'testings', 'action' => 'enter_result'), array('candidate_id'=>'[0-9]+', 'testing_id'=>'[0-9]+'));

    /**
     * Reports
     */
    Router::connect('/reports/consolidated/new', array('controller' => 'reports', 'action' => 'consolidate_create'));
    Router::connect('/reports/consolidated/', array('controller' => 'reports', 'action' => 'consolidate_list'));
    Router::connect('/clients/:client_id/reports/consolidated/new', array('controller' => 'reports', 'action' => 'consolidate_create'), array('client_id'=>'[0-9]+'));
    Router::connect('/clients/:client_id/reports/consolidated/', array('controller' => 'reports', 'action' => 'consolidate_list'), array('client_id'=>'[0-9]+'));

    /**
     * Sendings
     */
    Router::connect('/sending-log/', array('controller' => 'sendings', 'action' => 'list_of'));
    Router::connect('/sending-log/:id', array('controller' => 'sendings', 'action' => 'view_body'), array('id'=>'[0-9]+'));

    /**
     * Emails
     */
    // Отправка отложенной почты.
    Router::connect('/emails-queue/', array('controller' => 'emails', 'action' => 'list_of'));
    Router::connect('/send_emails', array('controller' => 'emails', 'action' => 'sends'));

    /**
     * Applet
     */
    // Страница тестирования.
    Router::connect('/testing/:auth', array('controller' => 'applet', 'action' => 'go'), array('auth' => '[0-9a-zA-Z]+'));

    /**
     * Init
     */
    Router::connect('/init', array('controller' => 'init', 'action' => 'init'));

    /**
     * Pages
     */
    Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
    //Router::connect('*', array('controller' => 'pages', 'action' => 'error', 404));
?>
